package com.thread.practicetwo;

public class NewThread implements Runnable {
	Thread t;
	String name;

	public NewThread(String threadName) {
		name = threadName;
		t = new Thread(this, threadName);
		System.out.println(t);
		t.start();
	}

	@Override
	public void run() {
		for (int i = 0; i < 5; i++) {
			System.out.println(name + "\t" + i);
			try {
				Thread.sleep(200);
			} catch (InterruptedException e) {
				System.out.println(name + "线程休眠时其他线程试图中断");
			}
		}
		System.out.println(name + "线程关闭");

	}

}
